# -*- coding:utf-8 -*-
from sqlalchemy import Column, engine
from sqlalchemy.types import CHAR, Integer, String
from sqlalchemy.ext.declarative import declarative_base

#BaseModel = declarative_base()
# 扩展基类方法2.设置 declarative_base() 的 cls 参数
from utils.LinqAlchemy import ModelMixin

BaseModel = declarative_base(cls=ModelMixin)

def init_db():
    BaseModel.metadata.create_all(engine) #不会修改已存在的

def drop_db():
    BaseModel.metadata.drop_all(engine)


class CoCode(BaseModel):
    __tablename__ = 'Co_Code'

    CodeId = Column(Integer, primary_key=True)
    CName = Column(CHAR(30))
    CText = Column(String(80))
    CValue = Column(String(80))
    CSort = Column(Integer)
    Status = Column(Integer)

#init_db()  #自动建表
#drop_db()  #删除表


